<table class="tablesorter">
                                		<thead>
                                			<tr>
                                            <?php
                                            	foreach($overview_table_terms as $term_key=>$term_val){
                                            		if(isset($online_website_overview[0]->$term_key)){
                                            			echo '<th>'.$term_val['name'].'</th>';	
                                            		}	
                                            	}
                                            ?>
                                			</tr>
                                		</thead>
										<tbody>
                                        <?php
                                        foreach ($online_website_overview as $key=>$val) {
                                            echo '<tr>';
                                            foreach ($overview_table_terms as $term_key=>$term_val) {
                                                if (isset($val->$term_key)) {
                                                    if ($term_key == 'impression' || $term_key == 'click') {
                                                        echo '<td>'.number_format($val->$term_key).'</td>';
                                                    } elseif ($term_key == 'ctr') {
                                                        echo '<td>'.number_format($val->$term_key, 2, '.', '').'%</td>';
                                                    } elseif ($term_key == 'income') {
                                                        echo '<td>$'.number_format($val->$term_key).'</td>';
                                                    }elseif($term_key == 'date'){
                                                    	//report_detail/index/website/COSTCOBBS/start_date/2011-10-01/end_date/2011-10-31
														echo '<td><a href="/report_detail/index/website/'.$val->WEB_SITE.'/start_date/'.date('Y-m-01',strtotime($val->date.'/01')).'/end_date/'.date('Y-m-t',strtotime($val->date.'/01')).'">'.($val->$term_key).'</a></td>';
                                                    } 
													else
                                                        echo '<td>'.($val->$term_key).'</td>';
                                                }
                                            }

                                            echo '</tr>';
                                        }
                                        ?>
										</tbody>
                                	</table>